#include "TPSN2.h"
//#include "Msp430Timer.h"
//#include "Timer.h"

configuration TPSN2C
{}

implementation
{
  	components TPSN2M as App;	
  	components MainC; 
  
  	//LEDs
  	components LedsC;
  
  	//Timers
  	components new TimerMilliC() as Timer0;
  	components new TimerMilliC() as Timer2;
  	components new TimerMilliC() as Timer3;
  	components new TimerMilliC() as Timer4;
  	components new TimerMilliC() as Timer5;
  	components new TimerMilliC() as Timer6;
  	components new TimerMilliC() as Timer7;
  	components new TimerMilliC() as Timer8;
  	components new TimerMilliC() as Timer9;
  	components new TimerMilliC() as Timer10;
  	components new TimerMilliC() as Timer11;
  	components new TimerMilliC() as Timer12;
  	components new TimerMilliC() as Timer13;
  	components new TimerMilliC() as Timer14;
  	components new TimerMilliC() as Timer15;
	  
  	//Radio
  	components new AMSenderC(AM_PROJECT1);
  	components new AMReceiverC(AM_PROJECT1); 
	  
  	//components CC2420ActiveMessageC as Radio;
  	components ActiveMessageC as Radio;
	  
  	components RandomC;
  	components RandomMlcgC;	  
	
	/***************************************************/
	/*******************   Linking   *******************/
	/***************************************************/
	
  	App -> MainC.Boot;
  	App.Random -> RandomC;  
  	App.Seed -> RandomMlcgC.SeedInit; 
	  
  	//Timers  
  	App.timerLockLevel -> Timer2;
  	App.InterfaceTimer -> Timer3;
  	App.SyncWait -> Timer4;
  	App.SyncBackOff -> Timer5;
  	App.MinTimeToResync -> Timer6;  
  	App.InterfaceTimer2 -> Timer7;
  	App.ResyncTimer -> Timer8;
  	App.LevelRequestTimeOut -> Timer9;
  	App.TestTimer -> Timer10;
  	App.timerLevelRetransmission -> Timer11;
  	App.JoinNetworkTimer -> Timer12;
  	App.RootElectionTimer -> Timer13;
  	App.LevelRequestTimeOut2 -> Timer14;
  	App.LowestLevelReceivedTimer -> Timer15;
	  
  	//LEDs
  	App.Leds -> LedsC;
	    
  	//Radio
  	App.RadioSend -> AMSenderC;
  	App.RadioReceive -> AMReceiverC;
  	App.RadioPacket -> AMSenderC;
  	App.RadioAMPacket -> AMSenderC;
  	App.RadioControl -> Radio;
  	App.TimeStamp -> Radio;
	  	
  	// External interrupt on INT4
  	components HplAtm128InterruptC;
  	App.HplAtm128Interrupt -> HplAtm128InterruptC.Int4;
  	
  	// LocalTime
  	components LocalTimeMicroC;
  	App.LocalTime -> LocalTimeMicroC.LocalTime;
}